import request from "@/utils/request";

/**
 * 部门基本列表
 * @returns
 */

export const getDepartmentApi = () => {
  return request({
    method: "GET",
    url: "/company/department",
  });
};

/**
 *删除部门
 *@param
 */

export const deleteDepartmentApi = (id) => {
  return request({
    method: "DELETE",
    url: `/company/department/${id}`,
  });
};

/**
 *新增部门
 */

export const getNewDepartmentApi = (DepartmentObj) => {
  return request({
    method: "POST",
    url: "/company/department",
    data: DepartmentObj,
  });
};

/**
 * 获取部门负责人列表
 */

export const getHeadDepartmentApi = () => {
  return request({
    method: "GET",
    url: "/sys/user/simple",
  });
};

/**
 * 获取部门详情
 */

export const getDetailDepartmentApi = (id) => {
  return request({
    method: "GET",
    url: `/company/department/${id}`,
  });
};

/**
 * 修改部门详情
 */

export const updatedDetailDepartmentApi = (data) => {
  return request({
    method: "PUT",
    url: `/company/department/${data.id}`,
    data,
  });
};
